import React, { Component } from 'react'
export class Test extends Component {
  constructor(props) {
    super(props)
    this.state = {
      message: 'Hellow React',
      name: 'zjd',
    }
  }
  async changeText() {
    this.setState({
      message: this.state.message + '6',
    })
    const title = {
      name: 1,
      age: 2,
    }
    const title2 = {
      age: 3,
      job: 'coder',
    }
    // 1.setState内部使用该方法进行数据和并
    console.log(Object.assign({}, title2, title))
  }
  render() {
    return (
      <>
        <div>{this.state.message}</div>
        <button onClick={() => this.changeText()}>改变文本1</button>
        <div>{this.state.name}</div>
      </>
    )
  }
}
